package com.fz.us.admin.base.bean.search.projection;

import com.fz.us.admin.base.bean.search.SearchEnum;

/**
 * 查询 - 参数 - Projection
 * ============================================================================
 * 版权所有 2016 。
 *
 * @author fallenpanda
 * @version 1.0 2016-07-13 。
 * ============================================================================
 */
public abstract class Projection {

    protected final SearchEnum.ProjectionType projectionType;

    protected Projection(SearchEnum.ProjectionType projectionType) {
        this.projectionType = projectionType;
    }

    public SearchEnum.ProjectionType getProjectionType() {
        return projectionType;
    }

    public abstract static class Builder<T extends Projection, B extends Builder<T, B>> {

        private B theBuilder;

        protected SearchEnum.ProjectionType projectionType;

        protected Builder () {
            theBuilder = getThis();
        }

        protected abstract B getThis();

        public B setProjectionType(SearchEnum.ProjectionType projectionType) {
            this.projectionType = projectionType;
            return theBuilder;
        }

        public abstract T build();

    }

}
